{% extends "admin/base_site.html" %}
{% load admin_list i18n %}
{% load url from future %}
{% block extrastyle %}
  {{ block.super }}
  <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}/admin/css/changelists.css" />
  {% if cl.formset %}
    <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}/admin/css/forms.css" />
  {% endif %}
  {% if cl.formset or action_form %}
    {% url 'admin:jsi18n' as jsi18nurl %}
    <script type="text/javascript" src="{{ jsi18nurl|default:'../../jsi18n/' }}"></script>
  {% endif %}
  {{ media.css }}
  {% if not actions_on_top and not actions_on_bottom %}
    <style>
      #changelist table thead th:first-child {width: inherit}
    </style>
  {% endif %}
{% endblock %}

{% block extrahead %}
{{ block.super }}
{{ media.js }}
{% if action_form %}{% if actions_on_top or actions_on_bottom %}
<script type="text/javascript">
(function($) {
    $(document).ready(function($) {
        $("tr input.action-select").actions();
    });
})(django.jQuery);
</script>
{% endif %}{% endif %}
{% endblock %}

{% block bodyclass %}change-list{% endblock %}

{% if not is_popup %}
  {% block breadcrumbs %}
    <ul class="breadcrumb">
        <li><a href="../../">{% trans "Home" %}</a> <span class="divider">/</span></li>
        <li><a href="../">{{ app_label|capfirst }}</a> <span class="divider">/</span></li>
        <li class="active">{{ cl.opts.verbose_name_plural|capfirst }}</li>
    </ul>
  {% endblock %}
{% endif %}

{% block coltype %}flex{% endblock %}

{% block content %}
  <div id="content-main">
    {% block object-tools %}
        {% if has_add_permission %}
        <ul class="nav nav-list">
            {% block object-tools-items %}
            <li>
                <a href="add/{% if is_popup %}?_popup=1{% endif %}" class="addlink">
                {% blocktrans with cl.opts.verbose_name as name %}Add {{ name }}{% endblocktrans %}
                </a>
            </li>
            {% endblock %}
        </ul>
        {% endif %}
    {% endblock %}
    {% if cl.formset.errors %}
        <p class="alert alert-error">
        {% blocktrans count cl.formset.errors|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}
        </p>
        {{ cl.formset.non_form_errors }}
    {% endif %}
    <div class="module{% if cl.has_filters %} filter{% endif %}">
      {% block search %}{% search_form cl %}{% endblock %}
      {% block date_hierarchy %}{% date_hierarchy cl %}{% endblock %}


      <form id="changelist-form" action="" method="post"{% if cl.formset.is_multipart %} enctype="multipart/form-data"{% endif %}>{% csrf_token %}
      {% if cl.formset %}
        <div>{{ cl.formset.management_form }}</div>
      {% endif %}

      {% block result_list %}
          {% if action_form and actions_on_top and cl.full_result_count %}{% admin_actions %}{% endif %}
          {% result_list cl %}
          {% if action_form and actions_on_bottom and cl.full_result_count %}{% admin_actions %}{% endif %}
      {% endblock %}
      {% block pagination %}{% pagination cl %}{% endblock %}
      </form>
    </div>
  </div>
{% endblock %}
{% block sidebar %}
{% if cl.has_filters %}
  <div class="changelist-filter well" style="padding: 9px 0;">
    <h3 class="filter-title">{% trans 'Filter' %}</h3>
    {% for spec in cl.filter_specs %}{% admin_list_filter cl spec %}{% endfor %}
  </div>
{% endif %}
{% endblock %}
